<template>
	<view class="page-order-det" :style="$theme.pageStyle">
		<view class="top"> </view>
		<view class="body">
			<view class="body_title">
				<view class="tit">请填写你的疑问</view>
				<view class="avat">
					<view class="ava">
						<u-avatar-group :urls="urls" size="25" gap="0.4"></u-avatar-group>
					</view>
					<view class="ava_tit">
						当前有<span>{{randomNumber}}</span>位律师在线
					</view>
				</view>
			</view>
			
			<view class="body_box">
				
				<view class="" style="height: 20px;"></view>
				<u--form labelPosition="top" :model="Form" :rules="rules" ref="form1">
					<u-form-item labelWidth="120" label="基本情况" prop="submit.content" ref="item1">
						<u--textarea v-model="Form.submit.content"
							placeholder="1.事情发生在什么时候？                                             2.事情的大概？                                                                  3.您这边有没有相关证据提供？"
							height="140"></u--textarea>
					</u-form-item>
				</u--form>

				<view class="tips" style="font-size: 12px;color: #666;text-align: center;">
					精选律师，全程指导，累计解决案例15万+，累计金额286亿 +
				</view>

			</view>


			<view class="btn">
				<view class="btn_s" @click="Send()">
					提交我的问题
				</view>
			</view>

		</view>




	</view>
</template>

<script>
	import $H from '@/common/js/request.js';
	export default {
		data() {
			return {
				randomNumber: this.round(),
				id: '',
				mail: '',
				Order: {},
				Goods: {},
				timeData: {},
				description: 'AI 维权律师每天为大家生成 200+ 封起诉书，希望大家能支持这个项目，让更多人可以长期受益。谢谢！',
				pass: '',
				demand: '',
				urls: [
					'https://cdn.uviewui.com/uview/album/1.jpg',
					'https://cdn.uviewui.com/uview/album/2.jpg',
					'https://cdn.uviewui.com/uview/album/3.jpg',
					'https://cdn.uviewui.com/uview/album/4.jpg',
				],
				showType: false,
				showAddress: false,
				Form: {
					submit: {
						content: '',
					},
				},
				Typeactions: [
					[
						'合同纠纷',
						'民间借贷',
						'建设工程',
						'交通事故',
						'婚姻家庭',
						'劳动人事',
						'金融借款',
						'房屋买卖',
						'知识产权',
						'医疗纠纷',
						'侵权损害',
						'海事海尚',
						'人格权纠纷',
						'物权纠纷',
						'股权纠纷',
						'证券纠纷',
						'保险纠纷',
						'票据纠纷',
						'刑事辩护',
						'行政诉讼',
						'案件执行',
						'综合'
					]
				],
				radio: '',
				switchVal: false,
				province: "广东省",
				city: "广州市",
				area: "天河区",
				areaCode: "440106",
				visible: false,
				maskCloseAble: true,
				str: '',
				valCode: ["36", "3601", "360111"],
				val: ["江西省", "南昌市", "青山湖区"],
			};
		},
		onLoad(opt) {
			// this.id = opt.id;
			// this.getData();
		},
		methods: {
			round() {
				return String(Math.floor(Math.random() * 10000)).padStart(4, '0');
			},
			async Send() {

				if (this.Form.submit.content === '') {
					return uni.showToast({
						icon: "none",
						title: '请输入基本情况'
					})
				}

				try {
					const res = await $H.post('user/ask', {
						content: this.Form.submit.content
					}, {
						token: true
					});
					
					uni.navigateTo({
						url: '/chat/ask/list'
					})
					
					uni.showToast({
						icon: "none",
						title: res.msg
					})
				} catch (error) {
					// 处理错误
				}
			}
		},
	};
</script>

<style lang="scss" scoped>
	page {
		background-color: #f7f7f7;
	}

	.page-order-det {
		position: relative;

		.top {
			width: 100%;
			height: 548rpx;
			margin-top: -44px;
			background: linear-gradient(180deg, #e9e7ef 80%, #f0f0f4 100%);
		}

		.body {
			position: absolute;
			top: 100rpx;
			width: 100%;
			padding-bottom: 140rpx;

			.body_title {
				margin: 15px;

				.tit {
					font-size: 24px;
					font-weight: bold;
				}

				.avat {
					display: flex;
					margin-top: 10px;

					.ava {}

					.ava_tit {
						margin-left: 5px;
					}

					.ava_tit span {
						color: #ff9900;
						margin-right: 3px;
						margin-left: 3px;
					}
				}
			}

			.body_box {
				margin: 15px;
				background: #fff;
				border-radius: 15px;
				padding: 10px;
			}


		}
	}

	.btn {
		display: flex;
		justify-content: space-between;
		width: 100%;
		bottom: 0;
		position: fixed;
		padding-bottom: 20px;

		.btn_s {
			height: 50px;
			margin: 10px;
			background: linear-gradient(270deg, var(--color-primary), var(--color-primary-light-3));
			// box-shadow: 1px 12px 19px rgba(254, 53, 49, .37);
			width: 100%;
			border-radius: 8px;
			text-align: center;
			font-size: 16px;
			color: #fff;
			line-height: 50px;
		}
	}
</style>